/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author Duc Quyen
 */
public class ConnectDatabase {

    public ConnectDatabase() {
    }

    public static Connection getConnection() {
        Connection connection = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            String url = "jdbc:mysql://localhost:3306/timvieconline";
            connection = DriverManager.getConnection(url, "root", "root");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return connection;
    }
    public static void main(String[] args) {
        Connection con = ConnectDatabase.getConnection();
        System.out.println(con);
    }

}

